<?php
/**
 * CityModel
 *  
 * @author Administrator
 * @version 
 */
class Model_City extends Zend_Db_Table_Abstract
{
    /**
     * The default table name
     */
    protected $_name = 'tcl_common_district';
    
    
    public function getAllCity($level=1){
        
        $db = $this->getAdapter();
        $where = $db->quoteInto('level = ?', $level)
        		.$db->quoteInto(' AND id NOT IN(?)', array(26,29,30,31,32,33,34,35,36));
        $results = $this->fetchAll($where);
        
        return $results;
    }
    
    public function getCityChild($id) {
      
        if ($id) {
	     	$db = $this->getAdapter();
	    	$where = $db->quoteInto("upid = ?", $id)
	    	        .$db->quoteInto(' AND level = ?', '2');
	    	$results = $this->fetchAll($where);
        }

    	return $results;
    }
    
    public function getCity($id){

        $db = $this->getAdapter();
        $where = $db->quoteInto('id = ?', $id);
        $results = $this->fetchRow($where)->toArray();

        
        return $results;
    }

}
